/*
 * @Description:
 * @Author: ldx
 * @Date: 2022-06-10 12:57:19
 * @LastEditors: ldx
 * @LastEditTime: 2022-09-28 21:48:26
 */
import { message } from 'antd'
import rsa from 'js-crypto-rsa'
import React, { useEffect } from 'react'
import { useRecoilValue } from 'recoil'

// import { useRecoilState } from 'recoil'
import imgSrc from '@/assets/u3.png'
import { commonState } from '@/recoil'

// import { commonState } from '@/recoil'
// import styles from './index.module.less'
// import Icon from '@/components/Icon'
import PwdLogin from './pwdLogin'
const Login: React.FC<Record<string, never>> = () => {
  const search = window.location.search
  const publicKey = useRecoilValue(commonState.publicKey)
  console.log('publicKey', publicKey)
  useEffect(() => {
    if (!search) return

    if (search === '?error') {
      message.error('账号或密码错误')
    }
    if (search === '?disable') {
      message.error('账号未启用，请联系管理员')
    }
  }, [search])
  return (
    <div className="w-100vw h-100vh bg-#f1f2f6 login min-h-500px min-w-1200px relative">
      <div className="flex m-auto flex-col items-center absolute right-200px top-100px">
        <div className="flex flex-col my-30px">
          <div className="w-320px flex justify-center items-center">
            <img className="w-45px h-45px mr-30px" src={imgSrc} alt="404" />{' '}
            <div className="flex-col flex items-start">
              <span className="text-center  text-#ccc">中国人民解放军</span>
              <span className="text-center text-20px text-#ccc">
                海军指挥学院
              </span>
            </div>
          </div>
          <div className="inline mt-20px text-30px text-#333 text-center">
            数据库管理系统
          </div>{' '}
        </div>
        <PwdLogin />
      </div>
    </div>
  )
}
export default Login
